#!/bin/bash
# API 连通性测试脚本 (Linux/Mac)
# 使用方法: chmod +x run_api_test.sh && ./run_api_test.sh

echo ""
echo "========================================"
echo "    步语 (BuYu) API 连通性测试"
echo "========================================"
echo ""

# 切换到脚本所在目录
cd "$(dirname "$0")"

# 检查 Python 是否可用
if ! command -v python3 &> /dev/null; then
    echo "[错误] 未找到 Python3，请先安装 Python 3.8+"
    exit 1
fi

# 检查依赖
if ! python3 -c "import requests" &> /dev/null; then
    echo "[提示] 正在安装依赖..."
    pip3 install requests python-dotenv
fi

# 运行测试
python3 -m tests.test_api_connectivity "$@"
